
#include "linked_list.h"
#include <stdlib.h>
#include <string.h>

struct list_item *list_new_item(void *key1, void *key2) {
	struct list_item *p = (struct list_item *)malloc(sizeof(struct list_item));

	p->key1 = key1, p->key2 = key2;
	p->next = NULL;
	return p;
}

void list_free(struct linked_list *list) {
	struct list_item *p = list->head, *next;

	while (p != NULL) {
		next = p->next;
		free(p);
		p = next;
	}
}

void list_insert(struct linked_list *list, struct list_item *item) {
	if (list->tail == NULL) {
		list->head = list->tail = item;
	} else {
		list->tail->next = item;
		list->tail = item;
	}
}
